-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove consider-using-f-string lint rule and updates #12423
Remove consider-using-f-string lint rule and updates #12423
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
…into remove-consider-using-f-string
Pull Request Test Coverage Report for Build 9575098874Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only got through qiskit/converters
so far, but I need to context switch so I decided to leave a comment on the small amount of progress I've made so far. Overall this looks good thanks a ton for doing this, it's often a thankless job to do this kind of modernization.
I'm just curious did you do this all by hand or did you run something like pyupgrade
to automate it?
@@ -74,7 +74,7 @@ def __init__(self, adjacency_matrix: list | np.ndarray) -> None: | |||
raise CircuitError("The adjacency matrix must be symmetric.") | |||
|
|||
num_qubits = len(adjacency_matrix) | |||
circuit = QuantumCircuit(num_qubits, name="graph: %s" % (adjacency_matrix)) | |||
circuit = QuantumCircuit(num_qubits, name=f"graph: {adjacency_matrix}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not realize the circuit name for GraphState
was embedding a string representation of the adjacency matrix. Lol, that could be quite the string.
else: | ||
str_out = "{:.{}g}".format(single_inpt, ndigits) | ||
str_out = f"{single_inpt:.{ndigits}g}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize you could nest variables in an fstring like this for a formatter. That's a neat trick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, not my trick, but i thought it was cool, too! :)
Co-authored-by: Matthew Treinish <[email protected]>
Co-authored-by: Matthew Treinish <[email protected]>
Co-authored-by: Matthew Treinish <[email protected]>
by hand |
# Conflicts: # pyproject.toml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That certainly was a lot of effort, thanks for tackling this! Just some questions otherwise LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this file there are also some f-string disables, is this due to the mix with Latex? In that case couldn't it be resolved with additional braces, like you already did in some cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think some of these changes initially lead to unit test failures. i will at least narrow it down to make sure everything that can be updated is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind! looks like i may have missed the ide adding/not adding brackets. updates inbound
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind again! didn't realize those unit tests were skipped when i ran locally. i'll have to look into it later
Co-authored-by: Julien Gacon <[email protected]>
Co-authored-by: Julien Gacon <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for all the effort!
* remove consider-using-f-string lint rule and updates * reverting a latex update * f-string update based on review * Update qiskit/circuit/library/hamiltonian_gate.py Co-authored-by: Matthew Treinish <[email protected]> * Update qiskit/circuit/tools/pi_check.py Co-authored-by: Matthew Treinish <[email protected]> * Update qiskit/circuit/tools/pi_check.py Co-authored-by: Matthew Treinish <[email protected]> * updates after merge * Update qiskit/providers/models/backendproperties.py Co-authored-by: Julien Gacon <[email protected]> * Update qiskit/synthesis/linear/cnot_synth.py Co-authored-by: Julien Gacon <[email protected]> * updates from PR * latex fixes --------- Co-authored-by: Matthew Treinish <[email protected]> Co-authored-by: Julien Gacon <[email protected]>
Summary
#9614 removing
consider-using-f-string
Details and comments
This is a biggie. can break it down into smaller ones if desired... somehow :)